#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	int N;
	cin >> N;
	int sum = 0;
	int c = 0;
	int r = 0;
	int f = 0;
	while (N--)
	{
		int A;
		char T;
		cin >> A >> T;
		sum += A;
		if (T == 'C')
		{
			c += A;
		}
		else if(T=='R')
		{
			r += A;
		}
		else
		{
			f += A;
		}
	}
	printf("Total: %d animals\n", sum);
	printf("Total coneys: %d\n", c);
	printf("Total rats: %d\n", r);
	printf("Total frogs: %d\n", f);
	printf("Percentage of coneys: %.2lf %%\n", (c * 100 * 1.0) / sum);
	printf("Percentage of rats: %.2lf %%\n", (r * 100 * 1.0) / sum);
	printf("Percentage of frogs: %.2lf %%\n", (f * 100 * 1.0) / sum);
	return 0;
}